//
//  MenuHeadView.m
//  HTP
//
//  Created by admin on 15/10/31.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "MenuHeadView.h"
#define HEADIMAGEWIDTH 50
#define HEADPADDING 5
@interface MenuHeadView()

@property (nonatomic,retain) UIImageView    *headImg;

@property (nonatomic,retain) UILabel        *nameLbl;

@end
@implementation MenuHeadView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor clearColor]];
        [self _initUI];
    }
    return self;
}
/**
 *  绘制UI --- yunhe
 */
-(void)_initUI{
    _headImg                        = [[UIImageView alloc] initWithFrame:CGRectMake(HEADPADDING * 2.5, 0, HEADIMAGEWIDTH, HEADIMAGEWIDTH)];
    _headImg.layer.cornerRadius     = HEADIMAGEWIDTH / 2.0;
    _headImg.layer.masksToBounds    = YES;
    _headImg.backgroundColor        = [UIColor whiteColor];
    [_headImg setImage:[UIImage imageNamed:@"headimage"]];
    [self addSubview:_headImg];
    
    _nameLbl                        = [[UILabel alloc] initWithFrame:CGRectMake(HEADIMAGEWIDTH + HEADPADDING * 6.0, 0, self.frame.size.width - (HEADIMAGEWIDTH + HEADPADDING * 6.0), HEADIMAGEWIDTH)];
    
    _nameLbl.textAlignment          = _TEXT_ALIGN_LEFT;
    _nameLbl.textColor              = [UIColor whiteColor];
    _nameLbl.font                   = [UIFont fontWithName:@"Helvetica-BoldOblique" size:18];
    _nameLbl.text                   = @"青苗家教";
    [self addSubview:_nameLbl];
    
    UIButton *backBtn               = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [backBtn setBackgroundColor:[UIColor clearColor]];
    [backBtn addTarget:self action:@selector(clickHead) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:backBtn];
}
/**
 *  view 点击事件 yunhe
 */
-(void)clickHead{
    if (self.menuHeadDelegate) {
        [self.menuHeadDelegate clickMenuHead];
    }
}
-(void)setHeadData:(id)headData{
    _headData = headData;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
